**# Bookmark #1 Setting

*Windows
global root  = "G:/Dropbox/Environmental Injustice/Empirical"
global rawdata = "$root/rawdata"
global workdata = "$root/workdata"
global results = "$root/results"
global outfile = "$root/outfile"

cd "$workdata"


**# Bookmark #2 Fig. S2(A)
*(A) Trends in COD Emission Exposure in Higher- and Lower- SES Cities"

use "$outfile/Figure 1b.dta",clear
twoway ///
	(connected codbyses year if belowcl_median==0, msymbol(t) lpattern(solid)) ///
	(connected codbyses year if belowcl_median==1, msymbol(o) lpattern(dash)), /// 
	legend(position(4) ring(0) rows(1) order(1 "Higher-SES Cities" 2 "Lower-SES Cities")) ///
	ytitle("Mean COD Emissions (1,000 tons)",size(large)) xlabel(2001(1)2011) ///
	xtitle("") ///
	graphregion(lcolor(white) color(white)) ///
    plotregion(margin(zero) color(white)) ///
    ylabel(, nogrid)

graph export "$results/Fig. S2(A).pdf", as(pdf) name("Graph") replace

**# Bookmark #3 Fig. S2(B)
*(B) Gaps in COD Emissions between Higher- and Lower- SES Cities
	
use "$outfile/Fig. S2(B).dta",clear

egen city=group(area4d)
gen area2d=substr(area4d,1,2)
egen province=group(area2d)

reghdfe cod i.year i.year#c.belowcl_median,absorb(i.province) noconstant

parmest, norestore level(90)
keep if strpos(parm, "#c.belowcl_median")

gen year = real(substr(parm, 1, 4))
sort year

twoway ///
    (rcap min90 max90 year, lcolor(%50) lwidth(thin) ) ///
    (connected estimate year, ///
    lcolor(navy) lpattern(solid) lwidth(medthick) mlcolor(navy) mfcolor(white) msize(medium) msymbol(oh)), ///
    yline(0, lcolor(gs10) lwidth(thin)) ///
    xline(2005, lcolor(gs10) lpattern(dash)) ///
    ytitle("Gaps between Higher- and Lower- SES Cities",size(large)) ///
	xtitle("") ///
    xlabel(2001(1)2011) ///
    legend(off) ///
    yscale(range(-7 2)) ///
	graphregion(lcolor(white) color(white)) ///
    plotregion(margin(zero) color(white)) ///
	ylabel(, nogrid)

graph export "$results/Fig. S2(B).pdf", as(pdf) name("Graph") replace
	
**# Bookmark #4 Fig. S2(C)
*(C) Trends in Incidence Rate of Cardiovascular Disease

use "$outfile/Fig. S2(C).dta",clear

twoway ///
	(connected ratio1 year if lowedu5==0, msymbol(t) lpattern(solid)) ///
	(connected ratio1 year if lowedu5==1, msymbol(o) lpattern(dash)), /// 
	legend(position(4) ring(0) rows(1) order(1 "With College Education" 2 "Without College Education")) ///
	ytitle("Incidence Rate (%)",size(large)) ///
	xtitle("") ///
	xlabel(2000(5)2011) ylabel(3(1)8, nogrid) ///
	graphregion(lcolor(white) color(white)) ///
    plotregion(margin(zero) color(white)) ///
    ylabel(, nogrid)

graph export "$results/Fig. S2(C).pdf", as(pdf) name("Graph") replace


**# Bookmark #5 Fig. S2(D)
*(D) Trends in Daily Work Hours
use "$outfile/Fig. S2(D).dta",clear

twoway ///
	(connected meanhour year if lowedu5==0, msymbol(t) lpattern(solid)) ///
	(connected meanhour year if lowedu5==1, msymbol(o) lpattern(dash)), /// 
	legend(position(4) ring(0) rows(1) order(1 "With College Education" 2 "Without College Education")) ///
	ytitle("Mean Daily Work Hours",size(large)) ///
	xtitle("") ///
	xlabel(2000(5)2011) ylabel(7.5(0.1)8, nogrid) ///
	graphregion(lcolor(white) color(white)) ///
    plotregion(margin(zero) color(white)) ///
    ylabel(, nogrid)

graph export "$results/Fig. S2(D).pdf", as(pdf) name("Graph") replace
	